/**
 * @file 大屏项目
 */
import {Component, Fragment} from 'react';
import Class from '../class';
import Group from '../gaotuGroup';

const page = {
    1: <Class />,
    2: <Group />
};
class Grade extends Component {
    constructor(props) {
        super(props);
        this.state = {
            screenType: 1
        };
    }

    render() {
        const {screenType} = this.state;
        document.title = '实时大屏';
        let type = screenType;
        const locationhref = decodeURI(window.location.href);
        const params = locationhref.split('/');
        const Idstr = unescape(params[params.length - 1]);
        const typeIndex = Idstr.indexOf('类型');
        if (typeIndex > -1) {
            type = Number(Idstr.slice(typeIndex + 2));
        }
        return (
            <Fragment>
                {page[type]}
            </Fragment>
        );
    }
}

export default Grade;
